package com.example.hello;

import com.example.hello.client.WellForm.BootstrapWellFormState;
import com.vaadin.ui.AbstractComponent;

public class BootstrapWellForm extends AbstractComponent {

    public enum WellSize {
        SMALL, DEFAULT, LARGE
    }

    public BootstrapWellForm() {
        this(WellSize.DEFAULT);
    }

    public BootstrapWellForm(WellSize size) {
        this(BootstrapForm.Type.INLINE, size);
    }

    public BootstrapWellForm(BootstrapForm.Type type, WellSize size) {
        setType(type);
        setSize(size);

        setImmediate(true);
    }

    @Override
    protected BootstrapWellFormState getState() {
        return (BootstrapWellFormState) super.getState();
    }

    public WellSize getSize() {
        return WellSize.valueOf(getState().getSize());
    }

    public void setSize(WellSize size) {
        getState().setSize(size.toString());
    }

    public BootstrapForm.Type getType() {
        return BootstrapForm.Type.valueOf(getState().getType());
    }

    public void setType(BootstrapForm.Type type) {
        getState().setType(type.toString());
    }

}